export const getPopupInnerDom = (popupObj) => {
    const { popupData } = popupObj;
    const positionFix = 3; // 坐标保留几位小数

    return `
          <div class="common_popup_item">
              <h3>投诉ID: ${popupData.complaintId}</h3>
              <ul>
                <li>
                      <dl>
                          <dt>网络类型:</dt>
                          <dd>${popupData.networkFormat}</dd>
                      </dl>
                  </li>
                  <li>
                      <dl>
                          <dt>投诉类别:</dt>
                          <dd>${popupData.category}</dd>
                      </dl>
                  </li>
                  <li>
                      <dl>
                          <dt>投诉子类别:</dt>
                          <dd>${popupData.subCategory}</dd>
                      </dl>
                  </li>
                  <li>
                      <dl>
                          <dt>区县:</dt>
                          <dd>${popupData.district}</dd>
                      </dl>
                  </li>
                  <li>
                      <dl>
                          <dt>分发时间:</dt>
                          <dd>${popupData.dispatchTime}</dd>
                      </dl>
                  </li>
                  <li>
                      <dl>
                          <dt>cgi:</dt>
                          <dd>${popupData.cgi}</dd>
                      </dl>
                  </li>
                  <li>
                      <dl>
                          <dt>站名:</dt>
                          <dd>${popupData.stationNo}</dd>
                      </dl>
                  </li>
              </ul>
  
              <span data-function='getMore'>查看更多</span>
          </div>
      `;
}

export const getFeaturesPopupInnerDom = (popupObj, next) => {
    // console.log(popupObj)

    let str = `
        <ul class="features_top">
            <li>${popupObj.name}</li>
            <li>类型: ${popupObj.type}</li>
        </ul>
    `

    let currentDataList = []

    // console.log(popupObj.popupData)
    popupObj.popupData.forEach(item => {
        let currentData = item.get('pointData')

        currentDataList.push(currentData)

        if (!currentData) {
            return
        }

        const setFeaturesPopupStr = () => {
            return `
                <div class="feature_item" data-function='getSingleByFeatures' data-cgi='${currentData.cgi}'>
                <span data-function='getSingleByFeatures' data-cgi='${currentData.cgi}'>投诉ID: ${currentData.complaintId}</span>
                <dl data-function='getSingleByFeatures' data-cgi='${currentData.cgi}'>
                    <dt>cgi:</dt>
                    <dd>${currentData.cgi}</dd>
                </dl>
                <dl data-function='getSingleByFeatures' data-cgi='${currentData.cgi}'>
                    <dt>投诉类型:</dt>
                    <dd>${currentData.category}</dd>
                </dl>
            </div>
            `
        }

        str += setFeaturesPopupStr()
    })

    next(currentDataList)  // 输出业务数据

    return str
}


/* <div class="common_popup_item">
    <h3>${popupData.stationNo}</h3>
    <ul>
        <li>
            <dl>
                <dt>区县:</dt>
                <dd>${popupData.district}</dd>
            </dl>
        </li>
        <li>
            <dl>
                <dt>cgi:</dt>
                <dd>${popupData.cgi}</dd>
            </dl>
        </li>
        <li>
            <dl>
                <dt>网络类型:</dt>
                <dd>${popupData.networkFormat}</dd>
            </dl>
        </li>
        <li>
            <dl>
                <dt>投诉类别:</dt>
                <dd>${popupData.category}</dd>
            </dl>
        </li>
        <li>
            <dl>
                <dt>投诉子类别:</dt>
                <dd>${popupData.subCategory}</dd>
            </dl>
        </li>
        <li>
            <dl>
                <dt>经纬度:</dt>
                <dd>[${popupObj.coordinate[0].toFixed(positionFix)}, ${popupObj.coordinate[1].toFixed(positionFix)}]</dd>
            </dl>
        </li>
    </ul>

    <span data-function='getMore'>查看更多</span>
</div> */